package com.navinfo.tripanalysis.common.arithmetic;

import com.navinfo.tripanalysis.common.arithmetic.manager.AbstractArithmetic;
import com.navinfo.tripanalysis.common.arithmetic.common.CommonData;
import com.navinfo.tripanalysis.common.arithmetic.common.OuterStatisticData;
import com.navinfo.tripanalysis.common.arithmetic.custom.VarCalcNumber;

/**
 * 0200的附件报警位状态次数算法<br/>
 * 只有0200时，用来计算次数值<br/>
 * 空档滑行次数 急加速次数 急减速次数 猛踩油门次数<br/>
 * 输出：统计<br/>
 */
public class NumberBy0200 extends AbstractArithmetic<VarCalcNumber> {
    @Override
    public void calculate() {
        CommonData commonData = drivingData.getCommonData();
        // 当前点是否打开
        Boolean[] statusArr = new Boolean[]{
                commonData.isSlideNeutral(),
                commonData.isRapidAcceleration(),
                commonData.isRapidDeceleration(),
                commonData.isSlamTheAccelerator()
        };
        getObj().calc(statusArr);
    }


    @Override
    public void collect(OuterStatisticData statisticDataOut) {
        VarCalcNumber var = getObj().init(4);
        //空挡滑行次数、急加速次数、急减速次数、猛踩油门次数
        statisticDataOut.setNeutralGearCoastNumber(var.getNumber()[0]);
        statisticDataOut.setSharpUpSpeedNumber(var.getNumber()[1]);
        statisticDataOut.setSharpDownSpeedNumber(var.getNumber()[2]);
        statisticDataOut.setSharpStepOnGasNumber(var.getNumber()[3]);
    }
}
